export function guideList(data) {
  console.log('guideList= == ==>')
  var yearListTmp = [];
  var guideAllList = [];
  // guide指南
  var guideList = data.guideList;
  // console.log(uni.getStorageSync('yaowuzhinan_guide'))
  // GBK指南
  var pharmGKBList = data.zskGenesDrugsList;

  for (let i = 0; i < pharmGKBList.length; i++) {
    // 把GBK的年份 切割 注入到time
    yearListTmp.push(pharmGKBList[i].latestUpdate.substring(0, 4));
    // 更改GBK指南的属性名称 并注入到guideItem合并
    pharmGKBList[i].fileName = pharmGKBList[i].title;
    pharmGKBList[i].issueDate = pharmGKBList[i].latestUpdate;
    pharmGKBList[i].sourcePath = pharmGKBList[i].sourceUrl;
    pharmGKBList[i].issueYear = pharmGKBList[i].latestUpdate.substring(0, 4);
    pharmGKBList[i].fileType = 'urlFile';
    guideAllList.push(pharmGKBList[i]);
  }

  for (let i = 0; i < guideList.length; i++) {
    // 把guide的年份 切割 注入到time
    yearListTmp.push(guideList[i].issueDate.substring(0, 4));
    // console.log(guideList[i])
    guideList[i].drug = guideList[i].drugNameCn + ' ' + guideList[i].drugNameEn;
    // 注入到guideItem合并
    guideList[i].issueYear = guideList[i].issueDate.substring(0, 4);
    guideList[i].fileType = 'pdf';
    guideAllList.push(guideList[i]);
  }

  var yearList = yearListTmp.filter(function(item, index, yearListTmp) {
    // 当前元素，在原始数组中的第一个索引==当前索引值，否则返回当前元素
    return yearListTmp.indexOf(item, 0) === index;
  });
  return {
    guideAllList,
    yearList
  };
}
